﻿<Window x:Class="TestRunner.SettingsWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:testRunner="clr-namespace:TestRunner" 
        Title="NUnit Test Runner Settings" Height="160" Width="627">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="130" />
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="181*" />
            <ColumnDefinition Width="38" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="35" />
            <RowDefinition Height="35" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <Label 
            Grid.Row="0"
            Content="NUnit Folder Path" 
            Height="28" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Center"
            Margin="12,12,0,0" />
        <Label 
            Grid.Row="1"
            Content="NUnit Bitness" 
            Height="28" 
            HorizontalAlignment="Left" 
            VerticalAlignment="Center"
            Margin="12,12,0,0" />
        <TextBox
            x:Name="nunitPathTextBox"
            Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3"
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Center"
            >
            <!--Text="{Binding NUnitFolderPath}"-->
            <TextBox.Text>
                <Binding Path="NUnitFolderPath" UpdateSourceTrigger="PropertyChanged">
                    <Binding.ValidationRules>
                        <testRunner:NUnitFolderNameValidationRule/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <Button 
            Grid.Row="0" Grid.Column="4" 
            Content="..." 
            Width="25" Height="25" 
            Margin="0,0,10,0"
            Click="OnBrowseNUnitFolderPath"/>
        <RadioButton 
            x:Name="bitness32RadioButton"
            Grid.Row="1" Grid.Column="1"
            HorizontalAlignment="Left" 
            VerticalAlignment="Center"
            Content="32 bit"
            GroupName="bitness"
            />
        <RadioButton 
            x:Name="bitness64RadioButton"
            Grid.Row="1" Grid.Column="2"
            HorizontalAlignment="Left" 
            VerticalAlignment="Center"
            Content="64 bit"
            GroupName="bitness"
            />
        <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="2" HorizontalAlignment="Right">
            <StackPanel.Resources>
                <Style x:Key="validatedButtonStyle" TargetType="{x:Type Button}">
                    <Setter Property="IsEnabled" Value="false" />
                    <Style.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding ElementName=nunitPathTextBox, Path=(Validation.HasError)}" Value="false" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="IsEnabled" Value="true" />
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Resources>
            <Button 
                VerticalAlignment="Center"
                Height="30" 
                Width="75"
                Margin="10, 0,0,0"
                Style="{StaticResource validatedButtonStyle}"
                Content="OK" Click="OnOKButton" IsDefault="True" />
            <Button 
                VerticalAlignment="Center"
                Height="30" 
                Width="75"
                Margin="10, 0,10,0"
                Content="Cancel" Click="OnCancelButton" IsCancel="True" />
        </StackPanel>
    </Grid>
</Window>
